#ifndef list_included
#define list_included

class list
{
	public:
	class Item
	{
		public:
		long id;
		long index;

		void* ptr;		// is exported!
		Item* next;
		Item* prev;
		list* List;

		Item();

		bool SetID(long id);
	};

	private:
	Item* Start;
	Item* LastItem;
	long inf_count;

	bool blocked;

	public:
	list();
	~list();
	
	Item* Add(void* ptr);
	Item* AddFirst(void* ptr);
	void Clear(void);
	long Count(void);

	Item* GetItems(void);
	Item* FindItem(long id);
	Item* GetItem(long index);
	Item* GetItemByPointer(void* p);
	Item* GetLastItem(void);

	void AppendItem(list::Item* I);
	void EjectItem(list::Item* I);

	void* findItem(long id);
	void* getItem(long index);
	void* getLastItem(void);
	bool RemoveItem(list::Item* I);
	bool RemoveItem(void* ptr);
	bool removeItem(long index);
};

#endif